(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('babel-runtime/core-js/json/stringify')) :
	typeof define === 'function' && define.amd ? define(['exports', 'babel-runtime/core-js/json/stringify'], factory) :
	(factory((global.stat = {}),global._JSON$stringify));
}(this, (function (exports,_JSON$stringify) { 'use strict';

	_JSON$stringify = _JSON$stringify && _JSON$stringify.hasOwnProperty('default') ? _JSON$stringify['default'] : _JSON$stringify;

	var H5_format = function H5_format() {
		var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
		    _ref$channel = _ref.channel,
		    channel = _ref$channel === undefined ? '' : _ref$channel,
		    _ref$platform = _ref.platform,
		    platform = _ref$platform === undefined ? '' : _ref$platform,
		    _ref$userId = _ref.userId,
		    userId = _ref$userId === undefined ? '' : _ref$userId;

		var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

		if (!Array.isArray(data)) data = [data];

		var records = data.map(function (item) {
			var _pageParams = _JSON$stringify(item.pageParams);
			var _parentParams = _JSON$stringify(item.parentParams);
			var _actionParams = _JSON$stringify(item.actionParams);

			return {
				triggerTime: new Date().getTime().toString(),
				userId: userId,
				page: item.page,
				pageParams: _pageParams === '{}' ? '' : _pageParams,
				parentPage: item.parentPage,
				parentParams: _parentParams === '{}' ? '' : _parentParams,
				action: item.type || item.action,
				actionParams: _actionParams === '{}' ? '' : _actionParams,
				target: item.target
			};
		});

		return {
			base: {
				channel: channel,
				platform: platform
			},
			records: records
		};
	};

	exports.H5_format = H5_format;

	Object.defineProperty(exports, '__esModule', { value: true });

})));
